import os from 'os';
import { exec } from 'child_process';

function run() {
  // 判断是否是 macOS 系统
  if (os.platform() === 'darwin') {
    console.log('Running on macOS, setting permissions...');
    exec('chmod 777 .husky/*', (error, stdout, stderr) => {
      if (error) {
        console.error(`Error: ${error.message}`);
        return;
      }
      if (stderr) {
        console.error(`stderr: ${stderr}`);
        return;
      }
      console.log(`stdout: ${stdout}`);
    });
  } else {
    console.log('Not running on macOS, skipping permission change.');
  }
}

run();